<template>
  <div class="app-container search-table-box aidex-table">
    <el-card shadow="never" ref="queryRef" style="margin-bottom: 12px;" class="search_card" v-show="showSearch">
      <div class="filter-container">
        <div class="search_box">
          <el-form :model="queryParams" ref="queryForm" label-width="80px" size="mini">
            <el-row :gutter="16">
              <el-col :md="6" >
                <el-form-item label="发票ID" prop="invoiceId">
                  <el-input
                    v-model="queryParams.invoiceId"
                    placeholder="请输入发票ID"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" >
                <el-form-item label="公司代码" prop="custId">
                  <el-input
                    v-model="queryParams.custId"
                    placeholder="请输入公司代码"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" >
                <el-form-item label="客户公司代码" prop="siteCode">
                    <el-input v-model="queryParams.params.companynames" maxlength = 0 clearable placeholder="请选择客户公司代码" >
                        <el-button slot="append" icon="el-icon-search" @click="openSearchsiteCodeDialogOpen">
                        </el-button>
                    </el-input>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="文件地址" prop="fileAddress">
                  <el-input
                    v-model="queryParams.fileAddress"
                    placeholder="请输入文件地址"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="源文件地址" prop="originalAddress">
                  <el-input
                    v-model="queryParams.originalAddress"
                    placeholder="请输入源文件地址"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="旋转前文件地址" prop="fileAddressBeforeRotate">
                  <el-input
                    v-model="queryParams.fileAddressBeforeRotate"
                    placeholder="请输入旋转前文件地址"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="文件扫描时间">
                  <el-date-picker
                    v-model="daterangeScanTime"
                    style="width: 100%"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="发票类型代码" prop="invoiceType">
                  <el-select v-model="queryParams.invoiceType" placeholder="请选择发票类型代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.non_invoice_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="票据类型" prop="noteType">
                  <el-select v-model="queryParams.noteType" placeholder="请选择票据类型" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.note_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="发票代码" prop="invoiceCode">
                  <el-input
                    v-model="queryParams.invoiceCode"
                    placeholder="请输入发票代码"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="发票号码" prop="invoiceNo">
                  <el-input
                    v-model="queryParams.invoiceNo"
                    placeholder="请输入发票号码"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="乘车日期" prop="invoiceDate">
                  <el-input
                    v-model="queryParams.invoiceDate"
                    placeholder="请输入乘车日期"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="用途备注" prop="useRemark">
                  <el-input
                    v-model="queryParams.useRemark"
                    placeholder="请输入用途备注"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="不含税金额" prop="totalAmount">
                  <el-input
                    v-model="queryParams.totalAmount"
                    placeholder="请输入不含税金额"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="合计税额" prop="totalTax">
                  <el-input
                    v-model="queryParams.totalTax"
                    placeholder="请输入合计税额"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="价税合计" prop="amountTax">
                  <el-input
                    v-model="queryParams.amountTax"
                    placeholder="请输入价税合计"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="可抵扣税额" prop="deductTax">
                  <el-input
                    v-model="queryParams.deductTax"
                    placeholder="请输入可抵扣税额"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="旅客姓名" prop="drawer">
                  <el-input
                    v-model="queryParams.drawer"
                    placeholder="请输入旅客姓名"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="出发城市" prop="leaveCity">
                  <el-input
                    v-model="queryParams.leaveCity"
                    placeholder="请输入出发城市"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="到达城市" prop="arriveCity">
                  <el-input
                    v-model="queryParams.arriveCity"
                    placeholder="请输入到达城市"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="车次号" prop="trainNumber">
                  <el-input
                    v-model="queryParams.trainNumber"
                    placeholder="请输入车次号"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="车牌号" prop="carNo">
                  <el-input
                    v-model="queryParams.carNo"
                    placeholder="请输入车牌号"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="出发时间" prop="leaveTime">
                  <el-input
                    v-model="queryParams.leaveTime"
                    placeholder="请输入出发时间"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="到达时间" prop="arriveTime">
                  <el-input
                    v-model="queryParams.arriveTime"
                    placeholder="请输入到达时间"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="里程" prop="mileage">
                  <el-input
                    v-model="queryParams.mileage"
                    placeholder="请输入里程"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="有无影像" prop="hasPicture">
                  <el-select v-model="queryParams.hasPicture" placeholder="请选择有无影像" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.has_picture"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="查验时间">
                  <el-date-picker
                    v-model="daterangeInspectionTime"
                    style="width: 100%"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="查验状态代码" prop="inspectionStatus">
                  <el-select v-model="queryParams.inspectionStatus" placeholder="请选择查验状态代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.inspection_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="合规结果代码" prop="isComplianceCollect">
                  <el-select v-model="queryParams.isComplianceCollect" placeholder="请选择合规结果代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.is_compliance_collect"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="不合规原因描述" prop="complianceCollectDesc">
                  <el-input
                    v-model="queryParams.complianceCollectDesc"
                    placeholder="请输入不合规原因描述"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="查验失败描述" prop="inspectionErrorDesc">
                  <el-input
                    v-model="queryParams.inspectionErrorDesc"
                    placeholder="请输入查验失败描述"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="发票校验状态代码" prop="verifyStatus">
                  <el-select v-model="queryParams.verifyStatus" placeholder="请选择发票校验状态代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.verify_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="发票状态代码" prop="invoiceState">
                  <el-select v-model="queryParams.invoiceState" placeholder="请选择发票状态代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.invoice_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="红蓝发票代码" prop="isRed">
                  <el-select v-model="queryParams.isRed" placeholder="请选择红蓝发票代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.is_red"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="税局取票代码" prop="isPull">
                  <el-select v-model="queryParams.isPull" placeholder="请选择税局取票代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.is_pull"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="是否有旅客信息代码" prop="hasTraveller">
                  <el-select v-model="queryParams.hasTraveller" placeholder="请选择是否有旅客信息代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.has_traveller"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="发票签收状态代码" prop="signStatus">
                  <el-select v-model="queryParams.signStatus" placeholder="请选择发票签收状态代码" @change="handleQuery" clearable filterable  style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.sign_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="推送时间">
                  <el-date-picker
                    v-model="daterangePushTime"
                    style="width: 100%"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :md="6" v-if="advanced">
                <el-form-item label="ERP发票流水号" prop="erpSerialNumber">
                  <el-input
                    v-model="queryParams.erpSerialNumber"
                    placeholder="请输入ERP发票流水号"
                    clearable
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
              </el-col>
              <el-col :md="6" align="right" style="float: right;">
                <el-form-item>
                  <el-button class="filter-item" type="primary" @click="handleQuery">搜索</el-button>
                  <el-button class="filter-item" style="margin-left: 8px" @click="resetQuery">重置</el-button>
                  <a @click="toggleAdvanced" style="margin:0 4px 0 8px ;vertical-align: middle;">
                    {{ advanced ? '收起' : '展开' }}
                    <i :class="advanced ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
                  </a>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </div>
    </el-card>
    <el-card shadow="never" >
      <template #header>
        <el-row>
          <el-col :span="8">
            <div class="card-header">
              <el-button disabled type="text">出租车信息</el-button>
            </div>
          </el-col>
          <el-col :span="16">
            <div class="btn_box" align="right" style="float: right;">
              <el-button
                class="filter-item"
                style="margin-left: 8px;"
                type="primary"
                icon="el-icon-plus"
                @click="handleAdd"
                size="mini"
                v-hasPermi="['doc:chuzhuche:add']"
              >新增</el-button>
              <el-button
                class="filter-item"
                style="margin-left: 8px;"
                icon="el-icon-delete"
                type="danger"
                :disabled="multiple"
                @click="handleDelete"
                size="mini"
                v-if="!multiple"
                v-hasPermi="['doc:chuzhuche:remove']"
              >删除</el-button>
              <el-button
                class="filter-item"
                style="margin-left: 8px;"
                icon="el-icon-download"
                @click="handleExport"
                size="mini"
                v-hasPermi="['doc:chuzhuche:export']"
              >导出</el-button>
              <right-toolbar :showSearch.sync="showSearch" @showSearchFun="showSearchFun" @queryTable="getList"></right-toolbar>
            </div>
          </el-col>
        </el-row>
      </template>

      <el-table
              border
              stripe
              default-expand-all
              ref="tableRef"
              v-loading="loading"
              :data="chuzhucheList"
              @selection-change="handleSelectionChange"
              :row-style="rowClass"
              :header-cell-style= "{
                'font-size': '14px !important',
                'font-weight': '500 !important',
                'background-color':'rgb(241 241 241 / 52%)'
              }"
              highlight-current-row style="width: 100%;"
              :height="tableHeight"
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="id" align="center" prop="id" />
        <el-table-column label="发票ID" align="center" prop="invoiceId" />
        <el-table-column label="公司代码" align="center" prop="custId" />
        <el-table-column label="客户公司" align="center" prop="siteName" />
        <el-table-column label="文件地址" align="center" prop="fileAddress" />
        <el-table-column label="源文件地址" align="center" prop="originalAddress" />
        <el-table-column label="旋转前文件地址" align="center" prop="fileAddressBeforeRotate" />
        <el-table-column label="文件扫描时间" align="center" prop="scanTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.scanTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="发票类型" align="center" prop="invoiceTypeName" />
        <el-table-column label="票据名称" align="center" prop="noteName" />
        <el-table-column label="发票代码" align="center" prop="invoiceCode" />
        <el-table-column label="发票号码" align="center" prop="invoiceNo" />
        <el-table-column label="乘车日期" align="center" prop="invoiceDate" />
        <el-table-column label="用途备注" align="center" prop="useRemark" />
        <el-table-column label="不含税金额" align="center" prop="totalAmount" />
        <el-table-column label="合计税额" align="center" prop="totalTax" />
        <el-table-column label="价税合计" align="center" prop="amountTax" />
        <el-table-column label="可抵扣税额" align="center" prop="deductTax" />
        <el-table-column label="旅客姓名" align="center" prop="drawer" />
        <el-table-column label="备注" align="center" prop="remark" />
        <el-table-column label="出发城市" align="center" prop="leaveCity" />
        <el-table-column label="到达城市" align="center" prop="arriveCity" />
        <el-table-column label="车次号" align="center" prop="trainNumber" />
        <el-table-column label="车牌号" align="center" prop="carNo" />
        <el-table-column label="出发时间" align="center" prop="leaveTime" />
        <el-table-column label="到达时间" align="center" prop="arriveTime" />
        <el-table-column label="里程" align="center" prop="mileage" />
        <el-table-column label="有无影像" align="center" prop="hasPictureName" />
        <el-table-column label="查验时间" align="center" prop="inspectionTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.inspectionTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="查验状态" align="center" prop="inspectionStatusName" />
        <el-table-column label="合规结果" align="center" prop="isComplianceCollectName" />
        <el-table-column label="不合规原因描述" align="center" prop="complianceCollectDesc" />
        <el-table-column label="查验失败描述" align="center" prop="inspectionErrorDesc" />
        <el-table-column label="发票校验状态" align="center" prop="verifyStatusName" />
        <el-table-column label="发票状态" align="center" prop="invoiceStateName" />
        <el-table-column label="红蓝发票" align="center" prop="isRedName" />
        <el-table-column label="税局取票" align="center" prop="isPullName" />
        <el-table-column label="是否有旅客信息" align="center" prop="hasTravellerName" />
        <el-table-column label="发票签收状态" align="center" prop="signStatusName" />
        <el-table-column label="推送时间" align="center" prop="pushTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.pushTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="发票采集业务系统配置" align="center" prop="collectinvUseType" />
        <el-table-column label="ERP发票流水号" align="center" prop="erpSerialNumber" />
        <el-table-column label="创建时间" align="center" prop="createTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="修改人" align="center" prop="updateBy" />
        <el-table-column label="修改时间" align="center" prop="updateTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['doc:chuzhuche:edit']"
            >修改</el-button>
            <el-divider direction="vertical"></el-divider>
            <el-button
              type="text"
              style="color: red;"
              @click="handleDelete(scope.row)"
              v-hasPermi="['doc:chuzhuche:remove']"
            >删除</el-button>
          </template>
        </el-table-column>
        <div slot="empty">
          <svg-icon icon-class="search-none" style="font-size: 64px;" />
          <p>暂无数据</p>
        </div>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />

      <!-- 添加或修改出租车对话框 -->
      <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="720px" top="10vh" append-to-body>
        <div style="height: 490px;overflow: auto; padding: 12px 24px;">
          <el-form ref="form" size="mini" :model="form" :rules="rules" label-position="top">
            <el-row :gutter="24">
              <el-col :span="12">
                <el-form-item label="发票ID" prop="invoiceId">
                  <el-input v-model="form.invoiceId" placeholder="请输入发票ID" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="公司代码" prop="custId">
                  <el-input v-model="form.custId" placeholder="请输入公司代码" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="${columnAlias}" prop="siteCode">
                    <el-input
                            v-model="form.companyname"
                            maxlength = 0
                            clearable
                            readonly
                            placeholder="请选择客户公司代码"
                    >
                        <el-button slot="append" icon="el-icon-search" @click="opensiteCodeDialogOpen">
                        </el-button>
                    </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="客户公司" prop="siteName">
                  <el-input v-model="form.siteName" placeholder="请输入客户公司" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="文件地址" prop="fileAddress">
                  <el-input v-model="form.fileAddress" placeholder="请输入文件地址" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="源文件地址" prop="originalAddress">
                  <el-input v-model="form.originalAddress" placeholder="请输入源文件地址" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="旋转前文件地址" prop="fileAddressBeforeRotate">
                  <el-input v-model="form.fileAddressBeforeRotate" placeholder="请输入旋转前文件地址" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="文件扫描时间" prop="scanTime">
                  <el-date-picker clearable
                    style="width: 100%;"
                    v-model="form.scanTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择文件扫描时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票类型代码" prop="invoiceType">
                  <el-select v-model="form.invoiceType" placeholder="请选择发票类型代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.non_invoice_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票类型" prop="invoiceTypeName">
                  <el-input v-model="form.invoiceTypeName" placeholder="请输入发票类型" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="票据类型" prop="noteType">
                  <el-select v-model="form.noteType" placeholder="请选择票据类型" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.note_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="票据名称" prop="noteName">
                  <el-input v-model="form.noteName" placeholder="请输入票据名称" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票代码" prop="invoiceCode">
                  <el-input v-model="form.invoiceCode" placeholder="请输入发票代码" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票号码" prop="invoiceNo">
                  <el-input v-model="form.invoiceNo" placeholder="请输入发票号码" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="乘车日期" prop="invoiceDate">
                  <el-input v-model="form.invoiceDate" placeholder="请输入乘车日期" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="用途备注" prop="useRemark">
                  <el-input v-model="form.useRemark" placeholder="请输入用途备注" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="不含税金额" prop="totalAmount">
                  <el-input v-model="form.totalAmount" placeholder="请输入不含税金额" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="合计税额" prop="totalTax">
                  <el-input v-model="form.totalTax" placeholder="请输入合计税额" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="价税合计" prop="amountTax">
                  <el-input v-model="form.amountTax" placeholder="请输入价税合计" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="可抵扣税额" prop="deductTax">
                  <el-input v-model="form.deductTax" placeholder="请输入可抵扣税额" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="旅客姓名" prop="drawer">
                  <el-input v-model="form.drawer" placeholder="请输入旅客姓名" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="备注" prop="remark">
                  <el-input v-model="form.remark" placeholder="请输入备注" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="出发城市" prop="leaveCity">
                  <el-input v-model="form.leaveCity" placeholder="请输入出发城市" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="到达城市" prop="arriveCity">
                  <el-input v-model="form.arriveCity" placeholder="请输入到达城市" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="车次号" prop="trainNumber">
                  <el-input v-model="form.trainNumber" placeholder="请输入车次号" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="车牌号" prop="carNo">
                  <el-input v-model="form.carNo" placeholder="请输入车牌号" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="出发时间" prop="leaveTime">
                  <el-input v-model="form.leaveTime" placeholder="请输入出发时间" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="到达时间" prop="arriveTime">
                  <el-input v-model="form.arriveTime" placeholder="请输入到达时间" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="里程" prop="mileage">
                  <el-input v-model="form.mileage" placeholder="请输入里程" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有无影像" prop="hasPicture">
                  <el-select v-model="form.hasPicture" placeholder="请选择有无影像" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.has_picture"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有无影像" prop="hasPictureName">
                  <el-input v-model="form.hasPictureName" placeholder="请输入有无影像" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="查验时间" prop="inspectionTime">
                  <el-date-picker clearable
                    style="width: 100%;"
                    v-model="form.inspectionTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择查验时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="查验状态代码" prop="inspectionStatus">
                  <el-select v-model="form.inspectionStatus" placeholder="请选择查验状态代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.inspection_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="查验状态" prop="inspectionStatusName">
                  <el-input v-model="form.inspectionStatusName" placeholder="请输入查验状态" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="合规结果代码" prop="isComplianceCollect">
                  <el-select v-model="form.isComplianceCollect" placeholder="请选择合规结果代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.is_compliance_collect"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="合规结果" prop="isComplianceCollectName">
                  <el-input v-model="form.isComplianceCollectName" placeholder="请输入合规结果" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="不合规原因描述" prop="complianceCollectDesc">
                  <el-input v-model="form.complianceCollectDesc" placeholder="请输入不合规原因描述" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="查验失败描述" prop="inspectionErrorDesc">
                  <el-input v-model="form.inspectionErrorDesc" placeholder="请输入查验失败描述" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票校验状态代码" prop="verifyStatus">
                  <el-select v-model="form.verifyStatus" placeholder="请选择发票校验状态代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.verify_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票校验状态" prop="verifyStatusName">
                  <el-input v-model="form.verifyStatusName" placeholder="请输入发票校验状态" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票状态代码" prop="invoiceState">
                  <el-select v-model="form.invoiceState" placeholder="请选择发票状态代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.invoice_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票状态" prop="invoiceStateName">
                  <el-input v-model="form.invoiceStateName" placeholder="请输入发票状态" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="红蓝发票代码" prop="isRed">
                  <el-select v-model="form.isRed" placeholder="请选择红蓝发票代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.is_red"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="红蓝发票" prop="isRedName">
                  <el-input v-model="form.isRedName" placeholder="请输入红蓝发票" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="税局取票代码" prop="isPull">
                  <el-select v-model="form.isPull" placeholder="请选择税局取票代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.is_pull"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="税局取票" prop="isPullName">
                  <el-input v-model="form.isPullName" placeholder="请输入税局取票" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="是否有旅客信息代码" prop="hasTraveller">
                  <el-select v-model="form.hasTraveller" placeholder="请选择是否有旅客信息代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.has_traveller"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="是否有旅客信息" prop="hasTravellerName">
                  <el-input v-model="form.hasTravellerName" placeholder="请输入是否有旅客信息" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票签收状态代码" prop="signStatus">
                  <el-select v-model="form.signStatus" placeholder="请选择发票签收状态代码" clearable filterable style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.sign_status"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="发票签收状态" prop="signStatusName">
                  <el-input v-model="form.signStatusName" placeholder="请输入发票签收状态" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="推送时间" prop="pushTime">
                  <el-date-picker clearable
                    style="width: 100%;"
                    v-model="form.pushTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择推送时间">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="ERP发票流水号" prop="erpSerialNumber">
                  <el-input v-model="form.erpSerialNumber" placeholder="请输入ERP发票流水号" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary"  size="mini" @click="submitForm">确 定</el-button>
          <el-button  size="mini" @click="cancel">取 消</el-button>
        </div>
      </el-dialog>

      <!-- 查询条件-${column.columnAlias}-弹出查询 -->
      <el-dialog v-dialogDrag  :close-on-click-modal="false" title="查询条件-${column.columnAlias}查询" :visible.sync="searchsiteCodeDialogOpen" width="800px" append-to-body>
        <div class="dialog_box" style="height:550px;">
            <el-form label-position="left" :model="searchsiteCodeQueryParams" :inline="true"  ref="searchsiteCodeQueryForm" label-width="88px" >
                <el-form-item  prop="searchsiteCodeSearchValue">
                    <el-input
                            v-model="searchsiteCodeQueryParams.searchValue"
                            size="mini"
                            placeholder="请输入编码或名称查询${column.columnAlias}"
                            @keyup.enter.native="handleSearchsiteCodeQuery"
                            clearable
                    />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchsiteCodeQuery">查询</el-button>
                </el-form-item>
            </el-form>
            <el-table v-loading="searchsiteCodeSelectLoading" :data="searchsiteCodeList"
                      height="400"
                      @row-click="handleSearchsiteCodeRowClick"
                      ref="searchsiteCodeMultipleTable"
                      :row-key="getSearchsiteCodeListRowKey"
                      :row-style="{height:2+'px'}"
                      :header-cell-style= "{
                        'font-size': '14px !important',
                        'font-weight': '500 !important',
                        'background-color':'rgb(241 241 241 / 52%)'
                      }"
                      :cell-style="{padding:'2px 4px'}"
                      border
                      @selection-change="handleSearchsiteCodeSelectionChange">
                <el-table-column type="selection" width="55" align="center"/>
                <!-- 数据 -->
                <el-table-column prop="companycode" label="客户公司代码代码" width="180"></el-table-column>
                <el-table-column prop="companyname" label="客户公司代码名称" ></el-table-column>
                <el-table-column prop="remark" label="备注" width="120"></el-table-column>
            </el-table>
            <pagination
                    v-show="searchsiteCodeTotal>0"
                    :total="searchsiteCodeTotal"
                    :page.sync="searchsiteCodeQueryParams.pageNum"
                    :limit.sync="searchsiteCodeQueryParams.pageSize"
                    @pagination="getSearchsiteCodeList"
            />
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button size="mini" type="primary" @click="confirmSearchsiteCode">确 定</el-button>
            <el-button size="mini"   @click="searchsiteCodeCancel">取 消</el-button>
        </div>
    </el-dialog>

      <!-- 编辑-${column.columnAlias}-弹出查询 -->
      <el-dialog v-dialogDrag  :close-on-click-modal="false" title="编辑出租车-${column.columnAlias}选择" :visible.sync="siteCodeDialogOpen" width="800px" append-to-body>
        <div class="dialog_box" style="height:550px;">
            <el-form label-position="left" :model="siteCodeQueryParams" :inline="true"  ref="siteCodeQueryForm" label-width="88px" >
                <el-form-item  prop="siteCodeSearchValue">
                    <el-input
                            v-model="siteCodeQueryParams.searchValue"
                            size="mini"
                            placeholder="请输入编码或名称查询${column.columnAlias}"
                            @keyup.enter.native="handlesiteCodeQuery"
                            clearable
                    />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handlesiteCodeQuery">查询</el-button>
                </el-form-item>
            </el-form>
            <el-table v-loading="siteCodeSelectLoading" :data="siteCodeList"
                      height="400"
                      @row-click="handlesiteCodeRowClick"
                      ref="siteCodeSingleTable"
                      :row-key="getsiteCodeListRowKey"
                      :row-style="{height:2+'px'}"
                      :header-cell-style= "{
                        'font-size': '14px !important',
                        'font-weight': '500 !important',
                        'background-color':'rgb(241 241 241 / 52%)'
                      }"
                      :cell-style="{padding:'2px 4px'}"
                      border
                      @selection-change="handlesiteCodeSelectionChange">
                <el-table-column label="选择" width="60">
            　　　　<template slot-scope="scope">
            　　　　　　<el-radio v-model="siteCodeDialogRadio" :label="scope.row"><i></i></el-radio>
            　　　　</template>
            　　 </el-table-column>
                <!-- 数据 -->
                <el-table-column prop="companycode" label="${column.columnAlias}代码" width="180"></el-table-column>
                <el-table-column prop="companyname" label="${column.columnAlias}名称" ></el-table-column>
                <el-table-column prop="remark" label="备注" width="120"></el-table-column>
            </el-table>
            <pagination
                    v-show="siteCodeTotal>0"
                    :total="siteCodeTotal"
                    :page.sync="siteCodeQueryParams.pageNum"
                    :limit.sync="siteCodeQueryParams.pageSize"
                    @pagination="getsiteCodeList"
            />
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button size="mini" type="primary" @click="confirmsiteCode">确 定</el-button>
            <el-button size="mini" @click="siteCodeCancel">取 消</el-button>
        </div>
    </el-dialog>




    </el-card>
  </div>
</template>

<script>
import { listChuzhuche, getChuzhuche, delChuzhuche, addChuzhuche, updateChuzhuche } from "@/api/doc/chuzhuche";
import { listCompany as listcompany, getCompany as getcompany } from "@/api/core/company";
/* 城市列表 **/
import { provinceList, cityList, districtList } from "@/api/system/city";

export default {
  name: "Chuzhuche",
  dicts: ['note_type', 'inspection_status', 'non_invoice_type', 'has_picture', 'invoice_status', 'is_pull', 'sign_status', 'verify_status', 'has_traveller', 'is_red', 'is_compliance_collect'],
  data() {
    return {
      advanced: false,
      tableHeight: this.getInitTableHeight(),
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出租车表格数据
      chuzhucheList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // ERP发票流水号时间范围
      daterangeScanTime: [],
      // ERP发票流水号时间范围
      daterangeInspectionTime: [],
      // ERP发票流水号时间范围
      daterangePushTime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        params:{

        },
        invoiceId: null,
        custId: null,
        siteCode: null,
        fileAddress: null,
        originalAddress: null,
        fileAddressBeforeRotate: null,
        scanTime: null,
        invoiceType: null,
        noteType: null,
        invoiceCode: null,
        invoiceNo: null,
        invoiceDate: null,
        useRemark: null,
        totalAmount: null,
        totalTax: null,
        amountTax: null,
        deductTax: null,
        drawer: null,
        leaveCity: null,
        arriveCity: null,
        trainNumber: null,
        carNo: null,
        leaveTime: null,
        arriveTime: null,
        mileage: null,
        hasPicture: null,
        inspectionTime: null,
        inspectionStatus: null,
        isComplianceCollect: null,
        complianceCollectDesc: null,
        inspectionErrorDesc: null,
        verifyStatus: null,
        invoiceState: null,
        isRed: null,
        isPull: null,
        hasTraveller: null,
        signStatus: null,
        pushTime: null,
        collectinvUseType: null,
        erpSerialNumber: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },

      /* ======================================省市区======================================  */
      // 省
      provinceId: null,
      provinceList:[],
      // 市
      cityId: null,
      cityList:[],
      // 区
      districtId: null,
      districtList:[],

      /* ======================================查询条件-客户公司代码选择======================================  */
      searchsiteCodes:[],
      searchsiteCodenames:[],
      searchsiteCodeTotal: 0,
      searchsiteCodeList: [],
      searchsiteCodeDialogOpen: false,
      searchsiteCodeSelectLoading: false,
      searchsiteCodeQueryParams: {
          searchValue: null,
          pageNum: 1,
          pageSize: 20,
      },
      /* ======================================编辑-客户公司代码选择======================================  */
      siteCodename: null,
      siteCodeTotal: 0,
      siteCodeList: [],
      siteCodeDialogRadio: null,
      siteCodeDialogOpen: false,
      siteCodeSelectLoading: false,
      siteCodeQueryParams: {
          searchValue: null,
          pageNum: 1,
          pageSize: 20,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 行样式 */
    rowClass({ row, rowIndex }) {
      if (this.ids.includes(row.id)) {
          return { background: "#d9edf7", height:'20px' };
      } else {
          return { height:'20px'};
      }
    },
   /** 隐藏搜索按钮操作 */
   showSearchFun(isShowSearch){
      this.showSearch = isShowSearch
      let oldHeight = this.$refs.queryRef.$el.offsetHeight
      if(!isShowSearch){
          //当前是显示状态
          oldHeight = oldHeight + 12
      }else{
          oldHeight = oldHeight - 12
      }
      this.$nextTick(() => (
         this.tableHeight = this.$refs.tableRef.$el.offsetHeight - (this.$refs.queryRef.$el.offsetHeight-oldHeight)
      ))
    },
    /** 展开按钮操作 */
    toggleAdvanced() {
      const oldHeight = this.$refs.queryRef.$el.offsetHeight
      this.advanced = !this.advanced
      this.$nextTick(() => (
         this.tableHeight = this.$refs.tableRef.$el.offsetHeight - (this.$refs.queryRef.$el.offsetHeight-oldHeight)
      ))
    },
    /** 查询出租车列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeScanTime && '' != this.daterangeScanTime) {
        this.queryParams.params["beginScanTime"] = this.daterangeScanTime[0];
        this.queryParams.params["endScanTime"] = this.daterangeScanTime[1];
      }
      if (null != this.daterangeInspectionTime && '' != this.daterangeInspectionTime) {
        this.queryParams.params["beginInspectionTime"] = this.daterangeInspectionTime[0];
        this.queryParams.params["endInspectionTime"] = this.daterangeInspectionTime[1];
      }
      if (null != this.daterangePushTime && '' != this.daterangePushTime) {
        this.queryParams.params["beginPushTime"] = this.daterangePushTime[0];
        this.queryParams.params["endPushTime"] = this.daterangePushTime[1];
      }
      listChuzhuche(this.queryParams).then(response => {
        this.chuzhucheList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        invoiceId: null,
        custId: null,
        siteCode: null,
        siteName: null,
        fileAddress: null,
        originalAddress: null,
        fileAddressBeforeRotate: null,
        scanTime: null,
        invoiceType: null,
        invoiceTypeName: null,
        noteType: null,
        noteName: null,
        invoiceCode: null,
        invoiceNo: null,
        invoiceDate: null,
        useRemark: null,
        totalAmount: null,
        totalTax: null,
        amountTax: null,
        deductTax: null,
        drawer: null,
        remark: null,
        leaveCity: null,
        arriveCity: null,
        trainNumber: null,
        carNo: null,
        leaveTime: null,
        arriveTime: null,
        mileage: null,
        hasPicture: null,
        hasPictureName: null,
        inspectionTime: null,
        inspectionStatus: null,
        inspectionStatusName: null,
        isComplianceCollect: null,
        isComplianceCollectName: null,
        complianceCollectDesc: null,
        inspectionErrorDesc: null,
        verifyStatus: null,
        verifyStatusName: null,
        invoiceState: null,
        invoiceStateName: null,
        isRed: null,
        isRedName: null,
        isPull: null,
        isPullName: null,
        hasTraveller: null,
        hasTravellerName: null,
        signStatus: null,
        signStatusName: null,
        pushTime: null,
        collectinvUseType: null,
        erpSerialNumber: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },


      /* ※※ 查询 省市区 相关方法 start ※※ */
      // 获取省
      getProvinceList(){
          provinceList().then(response => {
              this.provinceList = response.data;
          });
      },
      // 获取市
      getCityList(){
          console.log(this.provinceId);
          cityList( {"parentId" : this.provinceId } ).then(response => {
              this.cityList = response.data;
          });
      },
      // 获取区县
      getDistrictList(){
          districtList( {"parentId" : this.cityId } ).then(response => {
              this.districtList = response.data;
          });
      },
      // 选中省份
      handleChangeProvince(val){
          // 给表单省字段赋值
          this.form.provinceid = val;
          let province = {};
          province = this.provinceList.find((item)=>{
              return item.id === val;
          });
          this.form.province = province.name;
          // 城市数据清空、区县数据清空;
          this.cityList = [];
          this.districtList = [];
          // 已选市、区数据清空
          this.cityId = null;
          this.districtId = null;
          // 表单城市、区县数据清空
          this.form.cityid = null;
          this.form.city = null;
          this.form.areaid = null;
          this.form.area = null;
          // 获取城市数据
          this.getCityList();
      },
      // 清空省份
      handleClearProvince(){
          // 城市数据清空、区县数据清空;
          this.cityList = [];
          this.districtList = [];
          // 已选市、区数据清空
          this.cityId = null;
          this.districtId = null;
          // 表单城市、区县数据清空
          this.form.cityid = null;
          this.form.city = null;
          this.form.areaid = null;
          this.form.area = null;
      },
      // 选中城市
      handleChangeCity(val){
          // 给表单市字段赋值
          this.form.cityid = val;
          let city = {};
          city = this.cityList.find((item)=>{
              return item.id === val;
          });
          this.form.city = city.name;
          // 区县数据清空
          this.districtList = [];
          // 已选区县清空
          this.districtId = null;
          // 表单区县清空
          this.form.areaid = null;
          this.form.area = null;
          // 获取城市数据
          this.getDistrictList();
      },
      // 清空省份
      handleClearCity(){
          // 区县数据清空
          this.districtList = [];
          // 已选区县清空
          this.districtId = null;
          // 表单区县清空
          this.form.areaid = null;
          this.form.area = null;
      },
      // 选中区县
      handleChangeDistrict(val){
          // 给表单省字段赋值
          this.form.areaid = val;
          let district = {};
          district = this.districtList.find((item)=>{
              return item.id === val;
          });
          this.form.area = district.name;
      },
      // 清空省份
      handleClearDistrict(){
          // 表单区县清空
          this.form.areaid = null;
          this.form.area = null;
      },

      /* ※※ 查询 省市区 相关方法 end ※※ */




    /* ※※ 查询 客户公司代码 相关方法 start ※※ */
    /** ① 弹出查询条件-客户公司代码 */
    openSearchsiteCodeDialogOpen(){
        this.searchsiteCodeDialogOpen = true;
        // 默认不查询
    },
    /** ② 单击行 **/
    handleSearchsiteCodeRowClick(row, column, event){
        this.$refs.searchsiteCodeSingleTable.toggleRowSelection(row);
    },
    /** ③ 行KEY **/
    getSearchsiteCodeListRowKey(row) {
        return row.companycode
    },
    /** ④ 选中客户公司代码 **/
    handleSearchsiteCodeSelectionChange(selection) {
        this.searchsiteCodes = selection.map(item => item.siteCode);
        this.searchsiteCodenames = selection.map(item => item.companyname);
    },
    /** ⑤ 点击查询按钮 **/
    handleSearchsiteCodeQuery(){
        this.searchsiteCodeQueryParams.pageNum = 1;
        this.getSearchsiteCodeList();
    },
    /** ⑥ 查询 **/
    getSearchsiteCodeList(){
        this.searchsiteCodeSelectLoading = true;
        listcompany(this.searchsiteCodeQueryParams).then(response => {
            this.searchsiteCodeList = response.rows;
            this.searchsiteCodeTotal = response.total;
            this.searchsiteCodeSelectLoading = false;
        });
    },
    /** ⑦ 点击确认查询 **/
    confirmSearchsiteCode() {
        if(this.searchsiteCodes.length > 0){
            this.queryParams.params.siteCodes = this.searchsiteCodes.join(',');
            this.queryParams.params.companynames = this.searchsiteCodenames.join(',');
        }
        // 关闭查询弹出框
        this.searchsiteCodeCancel();
    },
    /** ⑧ 点击关闭查询弹出框 **/
    searchsiteCodeCancel() {
        this.searchsiteCodeDialogOpen = false;
    },
    /* ※※ 查询 客户公司代码 相关方法 end ※※ */


    /* ※※ 编辑 客户公司代码 相关方法 start ※※ */
    /** ① 弹出编辑内容-客户公司代码 */
    opensiteCodeDialogOpen(){
        this.siteCodeDialogOpen = true;
        this.getsiteCodeList();
    },
    /** ② 单击行 **/
    handlesiteCodeRowClick(row, column, event){
        this.$refs.siteCodeSingleTable.toggleRowSelection(row);
    },
    /** ③ 行KEY **/
    getsiteCodeListRowKey(row) {
        return row.companycode
    },
    /** ④ 选中客户公司代码 **/
    handlesiteCodeSelectionChange(selection) {
        if (selection[0]) {
            this.siteCodeDialogRadio = selection[0]
            this.form.companycode = selection[0].companycode;
            this.form.companyname = selection[0].companyname;
        }
    },
    /** ⑤ 点击查询按钮 **/
    handlesiteCodeQuery(){
        this.siteCodeQueryParams.pageNum = 1;
        this.getsiteCodeList();
    },
    /** ⑥ 查询 **/
    getsiteCodeList(){
        this.siteCodeSelectLoading = true;
        listcompany(this.siteCodeQueryParams).then(response => {
            this.siteCodeList = response.rows;
            this.siteCodeTotal = response.total;
            this.siteCodeSelectLoading = false;
        });
    },
    /** ⑦ 点击确认查询 **/
    confirmsiteCode() {
        this.siteCodeCancel();
    },
    /** ⑧ 点击关闭查询弹出框 **/
    siteCodeCancel() {
        this.siteCodeDialogOpen = false;
    },
    /* ※※ 编辑 客户公司代码 相关方法 end ※※ */


    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeScanTime = [];
      this.daterangeInspectionTime = [];
      this.daterangePushTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加出租车";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getChuzhuche(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改出租车";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateChuzhuche(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addChuzhuche(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除出租车编号为"' + ids + '"的数据项？').then(function() {
        return delChuzhuche(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('doc/chuzhuche/export', {
        ...this.queryParams
      }, `chuzhuche_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
